package com.wwj.study.interview.chapter2;


import java.io.Serializable;

public class Order implements Cloneable, Serializable {


    private int orderId;
    private transient String orderCode ;  //transient 不会序列化
    private Member member;

    public Member getMember() {
        return member;
    }

    public void setMember(Member member) {
        this.member = member;
    }

    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }


    public String getOrderCode() {
        return orderCode;
    }

    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }

    @Override
    public String toString() {
        return "Order{" +
                "orderId=" + orderId +
                ", orderCode='" + orderCode + '\'' +
                ", member=" + member +
                '}';
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Order order = (Order) super.clone();
        Member member = (Member) order.getMember().clone();
        order.setMember(member);
        return order;
    }
}
